/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
   Copyright (C) 2017 Red Hat, Inc.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#ifndef GPUNVIDIA_CHANNEL_H_
#define GPUNVIDIA_CHANNEL_H_

#include "red-channel.h"
#include "spice/stream-device.h"


G_BEGIN_DECLS

/**
 * This type it's a RedChannel class which implement display
 * channel with input only by stream.
 * A pointer to StreamChannel can be converted to a RedChannel.
 */
typedef struct GpuNvidiaChannel GpuNvidiaChannel;
typedef struct GpuNvidiaChannelClass GpuNvidiaChannelClass;

#define TYPE_GPUNVIDIA_CHANNEL gpunvidia_channel_get_type()

#define GPUNVIDIA_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_GPUNVIDIA_CHANNEL, GpuNvidiaChannel))
#define GPUNVIDIA_CHANNEL_CLASS(klass) \
    (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_GPUNVIDIA_CHANNEL, GpuNvidiaChannelClass))
#define IS_GPUNVIDIA_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_GPUNVIDIA_CHANNEL))
#define IS_GPUNVIDIA_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_GPUNVIDIA_CHANNEL))
#define GPUNVIDIA_CHANNEL_GET_CLASS(obj) \
    (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_GPUNVIDIA_CHANNEL, GpuNvidiaChannelClass))

GType gpunvidia_channel_get_type(void) G_GNUC_CONST;

/**
 * Create GpuNvidiaChannel.
 */
GpuNvidiaChannel* gpunvidia_channel_new(RedsState *server, uint32_t id);

/**
 * Reset channel at initial state
 */
void gpunvidia_channel_reset(GpuNvidiaChannel *channel);

void gpunvidia_channel_change_format(GpuNvidiaChannel *channel, const StreamMsgFormat *fmt);

void gpunvidia_channel_send_data(GpuNvidiaChannel *channel, const void *data, size_t size, uint32_t mm_time);

void gpunvidia_channel_set_monitor_id(GpuNvidiaChannel *channel, int monitor_id);

int gpunvidia_channel_get_monitor_id(const GpuNvidiaChannel *channel);

void gpunvidia_device_set_dispose(gboolean val);

gboolean gpunvidia_device_is_dispose();

typedef void (*gpunvidia_channel_start_proc)(void *opaque, int start, GpuNvidiaChannel *channel);

G_END_DECLS


#endif /* GPUNVIDIA_CHANNEL_H_ */
